<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/common.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <ui:define name="title">
        Student List
    </ui:define>

    <ui:define name="head">
        <script>
            $(function() {
                $(document).tooltip();
            });
        </script>
        <style>
            label {
                display: inline-block;
                width: 100px;
            }
        </style>
          <link rel="stylesheet" href="../../res/css/admin-style.css"/>
    </ui:define>

    <ui:define name="pageheader">
        Student list
    </ui:define>

    <ui:define name="content">
        <h:form id="mainform">


            <h:dataTable  value="#{studentManager.allStudent}" var="s"
                         styleClass="order-table"
    			headerClass="order-table-header"
    			rowClasses="order-table-odd-row,order-table-even-row"
                         >
               
              <h:column
                    <f:facet name="header">
                        <h:commandLink value="StudentID" />
                    </f:facet>
                    #{s.studentId}
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:commandLink value="User name" />
                    </f:facet>
                    #{s.accounts.userName}
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:commandLink value="Full name" />
                    </f:facet>
                    #{s.accounts.fullName}
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:commandLink value="Email" />
                    </f:facet>
                    <h:outputText value="#{s.accounts.email}">
                    </h:outputText>
                </h:column>
              
                <h:column>
                    <f:facet name="header">
                        <h:commandLink value="Address" />
                    </f:facet>
                     <h:outputText value="#{s.accounts.address}">
                    </h:outputText>
                </h:column>
                <h:column >
                    <f:facet name="header">
                        <h:commandLink value="Birthday" />
                    </f:facet>
                     <h:outputText value="#{s.accounts.birthday}">
                         <f:convertDateTime pattern="dd-mm-yyyy" timeZone="GMT+7" />
                    </h:outputText>
                </h:column>
                 <h:column>
                    <f:facet name="header">
                        <h:commandLink value="Student Image:" />
                    </f:facet>
                     <p:commandButton value="View" id="cmlView" />
                     <p:overlayPanel for="cmlView">
                         <img width="200" height="250" src="#{s.accounts.image}" />
                     </p:overlayPanel>
                </h:column>
             
                <h:column>
                    <f:facet name="header" >
                        Options
                    </f:facet>
                    <h:commandLink action="#{studentManager.edit(s)}" class="icon-1 info-tooltip"  />
                    <h:commandLink action="#{studentManager.remove(s)}" styleClass="icon-2 info-tooltip" />
                    <!--<h:commandLink action="#{studentManager.pickCourse(s)}" class="icon-3 info-tooltip" id="btnCourse" />-->
       
                </h:column>

            </h:dataTable>
           
            <h:commandButton action="create" value="Add" class="buttons"/>
        </h:form>
    </ui:define>

</ui:composition>
